<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        body {
            background-image: url();
        }

        main {
            background-color: #666;
        }

        div {
            /* position: absolute; */
            /* top: 0; */
            display: none;
            width: 1300px;
            height: 250px;
            z-index: 1;
            margin: auto;
            transform: 1s;

        }

        img {
            width: 400px;
            height: 250px;

        }

        button {
            z-index: 33;
        }
    </style>
</head>

<body>
    <main>

        <div>
            <img src="./img/1.jpg" alt="">

            <img src="./img/2.jpg" alt="">

            <img src="./img/3.jpg" alt="">
        </div>
    </main>
    <button>显示皮肤</button>
    <script>
        var btn = document.querySelector('button')
        var di = document.querySelector('div')
        var doc = document.getElementsByTagName("body")[0]
        btn.onclick = function (e) {
            di.style.display = "block"
        }
        di.onclick = function (e) {
            e = e || window.event
            doc.style.backgroundImage = ""
            var bac = e.target.getAttribute("src")
            doc.style.backgroundImage = "url(" + bac + ")"
            di.style.display = "none"
        }
    </script>
</body>

</html>